﻿using T4UtilityBelt.DataDesigns;
using T4UtilityBelt.Writers;

namespace T4UtilityBelt.UxDesigns.Controls.Renderers.ViewModel
{
    public class EnumRenderer : PropertyRenderer<EnumControl, IEnumRenderer, EnumProperty>, IEnumRenderer
    {
        protected override void OnRenderUiXmlContentInput(EnumControl control, CodeWriter writer)
        {
        }

        protected override void OnRenderUiXmlContentReadOnly(EnumControl control, CodeWriter writer)
        {
        }

        protected override void OnRenderUiCode(EnumControl control, CodeWriter writer)
        {
            writer.WriteFormatLine(
@"      public Array {0}List
        {{
            get
            {{
                return Enum.GetValues(typeof({1}));
            }}
        }}
",
            control.PropertyName, control.Property.PropertyType
);
        }
    }
}